package JAVA1119;

public abstract class Shape {
    abstract public void draw();
    abstract void calcArea();
    public double getArea(){
        return area;
    }
    protected double area;
}
class Rect extends Shape{
    private double length;
    private double width;
    public Rect(double length,double width){
        this.length=length;
        this.width=width;
    }
    public void draw(){
        System.out.println("矩形：length="+length+"width="+width);
    }
    public void calcArea(){
        area=length*width;
        System.out.println("area="+area);
    }
}
class Cricle extends Shape{
    private double r;
    final private static double PI=3.14;
    private double area;

    public Cricle(double r){
        this.r = r;
    }
    public void draw(){
        System.out.println("园：r="+r);
    }
    public void calcArea(){
        area=PI*r*r;
    }
}
abstract class Triangle extends Shape{
    private double a;
    private double b;
    private double c;
    @Override
    public void draw(){
        System.out.println("三角形：a="+a+"b="+b+"c="+c);
    }
}
class Main{
    public static void main(String[] args) {
        Rect rect = new Rect(10,8);
        rect.calcArea();
    }
}
